<template>
  <div class="project-Container">
    <div class="head">
      <div class="search">
        <el-input
          placeholder="请输入姓名、昵称或注册手机号"
          suffix-icon="el-icon-search"
          v-model="search"
          @keyup.enter.native="getsearchList()"
        ></el-input>
      </div>
    </div>

    <el-table :data="List" border style="width: 100%">
      <el-table-column prop="index" label="序号" width="120"></el-table-column>
      <el-table-column prop="name" label="姓名"></el-table-column>
      <el-table-column prop="idCardNumber" label="身份证号"></el-table-column>
      <el-table-column prop="status1" label="是否认证"></el-table-column>
      <el-table-column prop="phone" label="注册手机号"></el-table-column>
      <el-table-column prop="cardNo" label="银行卡号"></el-table-column>
      <el-table-column prop="cardPhone" label="预留手机号"></el-table-column>
      <el-table-column prop="nikename" label="昵称"></el-table-column>
      <el-table-column label="头像">
        <template slot-scope="scope">
          <img :src="`http://mov.freebd.cn:808/file${scope.row.pic}`" style="height:50px">
        </template>
      </el-table-column>
      <el-table-column prop="money" label="账户余额"></el-table-column>
    </el-table>

      <div class="paginat">
      <el-pagination
        @current-change="handleCurrentChange"
        :current-page.sync="currentPage4"
        :page-size="10"
        layout="total, prev, pager, next"
        :total="total"
      ></el-pagination>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      dialogVisible: false,
      search: "",
      List: [],
      val: "",
      total: 0,
      currentPage4: 1,
    };
  },
  created() {
    this.getList();
  },
  methods: {
            //分页
    handleCurrentChange(val) {
      this.val = val;
      this.getList();
      console.log(`当前页: ${val}`);
    },
    //搜索数据
    getsearchList() {
      let url = "/user/getuser";
      let params = {
        name: this.search,
        pageNum: this.val,
        pageSize: 10
      };
      this.httpPost(url, params, res => {
        if (res.code == 200) {
          this.List = res.data.list;
          this.total = res.data.total;
          this.val = this.val == "" ? 1 : this.val;
          this.List.forEach((element, i) => {
            this.List[i].index = (this.val - 1) * 10 + i + 1;
          });
        }
      });
    },
    //获取数据
    getList() {
      let url = "/user/getuser";
      let params = {
        // name: this.search,
        // phone:"",
        pageNum: this.val,
        pageSize: 10
      };
      this.httpPost(url, params, res => {
        if (res.code == 200) {
          this.List = res.data.list;
          this.total = res.data.total;
          this.val = this.val == "" ? 1 : this.val;
          this.List.forEach((element, i) => {
            this.List[i].index = (this.val - 1) * 10 + i + 1;
            // console.log(this.list[0].status == 0);

            this.List[i].status1 = this.List[i].status == 1 ? '已认证' : '未认证';


            // if(this.list[i].status == 1){
            //     this.list[i].status = "已认证";
            // }else{
            //     this.list[i].status = "未认证"
            // }
          });
          console.log( this.List);
        }
      });
    }
  }
};
</script>

<style lang="scss" scoped>
.head {
  height: 60px;
  .search {
    width: 300px;
    height: 60px;
    float: right;
  }
}
</style>